﻿using Microsoft.Xna.Framework;

namespace Firefly.ExtensionMethods
{
    public static class Vector2Extensions
    {
        public static Vector3 ToVector3(this Vector2 obj)
        {
            return new Vector3(obj.X, obj.Y, 0);
        }

        public static Vector2 Parse(this Vector2 obj, string value)
        {
            string[] split = value.Split(',');

            if (split != null && split.Length == 2)
            {
                return new Vector2(float.Parse(split[0]), float.Parse(split[1]));
            }

            return Vector2.Zero;
        }

        public static Point ToPoint(this Vector2 value)
        {
            return new Point((int)value.X, (int)value.Y);
        }
    }
}